package com.bupt.hotel.hvac.model.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

/**
 * 房间类型枚举
 */
@Getter
public enum RoomType {
    
    /**
     * 标准间 - 300元/晚
     */
    STANDARD("STANDARD", "标准间", 300.0),
    
    /**
     * 大床房 - 500元/晚
     */
    DELUXE("DELUXE", "大床房", 500.0),
    
    /**
     * 豪华套房 - 800元/晚
     */
    SUITE("SUITE", "豪华套房", 800.0);
    
    @EnumValue
    @JsonValue
    private final String code;
    
    private final String name;
    
    /**
     * 房费（元/晚）
     */
    private final Double pricePerNight;
    
    RoomType(String code, String name, Double pricePerNight) {
        this.code = code;
        this.name = name;
        this.pricePerNight = pricePerNight;
    }
    
    /**
     * 根据 code 获取枚举
     */
    public static RoomType fromCode(String code) {
        for (RoomType type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        return STANDARD; // 默认返回标准间
    }
}

